public class Demo6 {
public static void main(String[] args) {
    Thread t=new Thread(()->{
       System.out.println("hello thread");
       while(true){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
       }
    },"我的线程");
    System.out.println("是否存活"+t.isAlive());
    t.start();
    System.out.println("是否存活"+t.isAlive());
    while(true){
        System.out.println("hello main");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
}
